package com.web;

import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.Set;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.bussiness.GeoInterface;
import com.bussiness.PoiInterface;
import com.bussiness.domain.Location;
import com.bussiness.domain.PoiTemplate;
import com.bussiness.domain.PoiTemplate.Type;
import com.bussiness.impl.GeoImpl;
import com.bussiness.impl.PoiImpl;

/**
 * Servlet implementation class ShowPois
 */
@WebServlet("/showpois.html")
public class ShowPoisServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public ShowPoisServlet() {
        super();
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doPost(request,response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
/*		GeoInterface gc = new GeoImpl();
		Location location = null;
		double distance = 0;
		Set<Location> set = gc.search(location, distance);*/
		
		PoiInterface poi = new PoiImpl();
		
		//put templates to jsp
		List<PoiTemplate> templates = poi.readAllPoiTemplates();
		request.setAttribute("poitemplates", templates);
		
		RequestDispatcher view = request.getRequestDispatcher("WEB-INF/pages/showpois.jsp");
		//request.
		view.forward(request, response);
	}

}
